package ruleengine.db.service;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.List;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.ruleengine.db.model.Rulechain;
import com.ruleengine.db.model.RulechainState;
import com.ruleengine.db.service.RulechainService;

import ruleengine.BaseTest;

/**
 * @author lianghanwei on 2024/3/17
 */
public class RulechainServiceTest extends BaseTest {

    @Autowired
    private RulechainService rulechainService;

    @Test
    public void getRulechains() {
        List<Rulechain> rulechains = rulechainService.getRulechains(DEMO_TENANT_ID, List.of(DEMO_RULECHAIN_ID));
        assertEquals(1, rulechains.size());
    }

    @Test
    public void updateRulechainState() {
        boolean result = rulechainService.updateRulechainState(DEMO_TENANT_ID, DEMO_RULECHAIN_ID, RulechainState.DISABLED, 0);
        assertTrue(result);
    }
}
